<template>
    <div class="chart" style="height: 500px;width: 1200px"/>
</template>

<script>
import echarts from 'echarts'
import {calcLessonPointTarget} from "@/api/stu/score";

require('echarts/lib/component/dataset');
require('echarts/lib/component/tooltip');
require('echarts/lib/component/grid');
require('echarts/lib/component/legend');
require('echarts/lib/chart/bar');

const animationDuration = 3000

export default {
    props: {
        chartDataList: {
            type: Array,
            default: ()=>[]
        }
    },
    data() {
        return {
            chart: null,
        }
    },
    beforeDestroy() {
        if (!this.chart) {
            return
        }
        this.chart.dispose()
        this.chart = null
    },
    methods: {
        initChart(list) {
            this.chart = echarts.init(this.$el)
            // let list = [];



            let option = {
                legend: {},
                tooltip: {},
                dataset: {
                    source: list
                },
                xAxis: {type: 'category'},
                yAxis: {},
                // Declare several bar series, each will be mapped
                // to a column of dataset.source by default.
                series: [{type: 'bar'}, {type: 'bar'}, {type: 'bar'}, {type: 'bar'}]
            }

            this.chart.setOption(option)







        }
    }
}
</script>
